package eerbaar.v2.app.view;

import java.awt.Point;

import eerbaar.v2.app.mouse.IMouseListener;
import eerbaar.v2.app.mouse.MouseEvent2;

public class HighlightMouse implements IMouseListener {

    private final IView view;

    public HighlightMouse(IView view) {
        this.view = view;
    }

    @Override
    public void mouseClicked(MouseEvent2 e) {
        //
    }

    @Override
    public void mouseExited() {
        Squares squares = this.view.getSquares();
        squares.setHighlighted(null);
    }

    @Override
    public void mouseMoved(MouseEvent2 event) {
        Point point = new Point(event.getX(), event.getY());
        Squares squares = this.view.getSquares();
        Square square = squares.getSquare(point);
        if (square != null) {
            squares.setHighlighted(square);
        }
    }

}
